home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 015a / tsbat30.zip / scanz.bat < prev    next >
DOS Batch File  |  1991-09-01  |  5KB  |  170 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────────────┐
  4. echo │ Scan a zip file for viruses including execompressed files │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Sun 01-Sep-1991   │
  6. echo └───────────────────────────────────────────────────────────┘
  7. echo.
  8.  
  9. rem If no parameters then give the instructions
  10. if "%1"=="" goto _help
  11.  
  12. rem First check that the zip file(s) exists
  13. if not exist %1 goto _err1
  14.  
  15. rem Check that you have the drive r: available (I have r: as ramdisk)
  16. if not exist r:\nul goto _err2
  17.  
  18. rem Check that the virus programs are available
  19. if not exist c:\tools\scan.exe goto _err3
  20. if not exist c:\tools\f-fchk.exe goto _err4
  21. if not exist c:\tools\sign.txt goto _err5
  22.  
  23. rem Check that pkunzip.exe is available
  24. if not exist c:\tools\pkunzip.exe goto _err6
  25.  
  26. rem Check that exeuncompressors are available
  27. if not exist c:\tools\pklite.exe goto _err7
  28. if not exist c:\box\boxtools\unlzexe.exe goto _err8
  29. if not exist c:\box\boxtools\diet.exe goto _err9
  30.  
  31. rem Check that the ask.exe facility is available
  32. set _found=
  33. if exist ask.exe set _found=yes
  34. for %%d in (%path%) do if exist %%d\ask.exe set _found=yes
  35. if not "%_found%"=="yes" goto _err10
  36.  
  37. rem Make a temporary directory and ensure that it is empty
  38. if not exist r:\tmp$$$\nul mkdir r:\tmp$$$
  39. if exist r:\tmp$$$\*.* echo Delete all old files from r:\TMP$$$ directory
  40. if exist r:\tmp$$$\*.* del r:\tmp$$$\*.*
  41.  
  42. rem Unzip all .exe, .com, overlay-files and embedded zips from the zipfile
  43. c:\tools\pkunzip %1 *.exe *.com *.ov* *.zip r:\tmp$$$
  44. if exist r:\tmp$$$\*.zip c:\tools\pkunzip r:\tmp$$$\*.zip r:\tmp$$$
  45. if exist r:\tmp$$$\*.zip del r:\tmp$$$\*.zip
  46. if errorlevel=1 goto _ziperror
  47.  
  48. rem Check for nasties with scan, first pass
  49. if exist r:\tmp$$$\*.* scan /a r:\tmp$$$\*.* /nomem
  50. if errorlevel=2 goto _scanerr
  51. if errorlevel=1 goto _virus
  52.  
  53. rem Check for nasties with f-fchk, first pass
  54. if exist r:\tmp$$$\*.* f-fchk r:\tmp$$$\*.* /all
  55. :_ask1
  56. echo.
  57. ask Next second pass, with expansion, continue (y/n)? /d /u
  58. if errorlevel==89 if not errorlevel==90 goto _expand
  59. if errorlevel==78 if not errorlevel==79 goto _rmdir
  60. goto _ask1
  61.  
  62. rem Expand execompressed files
  63. :_expand
  64. for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\tools\pklite -x %%f
  65. for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\box\boxtools\diet -ra %%f
  66. :_ask2
  67. ask Try to expand lzexed files (y/n)? /d /u
  68. if errorlevel==89 if not errorlevel==90 goto _unlzexe
  69. if errorlevel==78 if not errorlevel==79 goto _nounlzexe
  70. goto _ask2
  71. :_unlzexe
  72. for %%f in (r:\tmp$$$\*.exe) do c:\box\boxtools\unlzexe %%f
  73. if exist r:\tmp$$$\*.olz del r:\tmp$$$\*.olz
  74.  
  75. :_nounlzexe
  76. rem Check for nasties with scan, second pass
  77. if exist r:\tmp$$$\*.* scan /a r:\tmp$$$\*.* /nomem
  78. if errorlevel=2 goto _scanerr
  79. if errorlevel=1 goto _virus
  80.  
  81. rem Check for nasties with f-fchk, second pass
  82. if exist r:\tmp$$$\*.* f-fchk r:\tmp$$$\*.* /all
  83. goto _rmdir
  84.  
  85. :_virus
  86. echo Viruses have been detected, batch terminated
  87. echo The infected files remain in directory r:\TMP$$$
  88. echo Take immediate measures to protect yourself
  89. goto _out
  90.  
  91. rem Error in zipfile
  92. :_ziperror
  93. echo Error in .zip file, batch terminated
  94.  
  95. rem Remove the temporary directory and its files
  96. :_rmdir
  97. if not exist r:\tmp$$$\*.* goto _chdir
  98. echo y | del r:\tmp$$$\*.* > nul
  99. :_chdir
  100. cd r:\
  101. if exist r:\tmp$$$\nul rmdir r:\tmp$$$
  102. goto _out
  103.  
  104. rem The instructions
  105. :_help
  106. echo Usage: SCANZ [ZipFileName]
  107. echo.
  108. echo You will need the following shareware and PD programs to use this batch.
  109. echo They are available from good BBSes or from garbo.uwasa.fi by anonymous ftp.
  110. echo    PKUNZIP.EXE from PKZ110.EXE or PKZ110EU.EXE
  111. echo    SCAN.EXE from SCANV80.ZIP
  112. echo    F-FCHK.EXE and SIGN.TXT from FPROT116.ZIP
  113. echo    PKLITE.EXE from PKLTE105.EXE
  114. echo    UNLZEXE.EXE from UNLZEXE5.ZIP
  115. echo    DIET.EXE from DIET110A.ZIP
  116. echo    ASK.EXE from TSBAT26.ARC
  117. echo Before using this batch you have to edit all the directory paths of this
  118. echo batch to correspond to your own configuration.
  119. echo.
  120. goto _out
  121.  
  122. :_err1
  123. echo File %1 not found
  124. goto _out
  125.  
  126. :_err2
  127. echo Drive R: not found
  128. echo Adjust your configuration or this batch
  129. goto _out
  130.  
  131. :_err3
  132. echo File c:\tools\scan.exe not found
  133. goto _out
  134.  
  135. :_err4
  136. echo File c:\tools\f-fchk.exe not found
  137. goto _out
  138.  
  139. :_err5
  140. echo File c:\tools\sign.txt not found
  141. goto _out
  142.  
  143. :_err6
  144. echo File c:\tools\pkunzip.exe not found
  145. goto _out
  146.  
  147. :_err7
  148. echo File c:\tools\pklite.exe not found
  149. goto _out
  150.  
  151. :_err8
  152. echo File c:\box\boxtools\unlzexe.exe not found
  153. goto _out
  154.  
  155. :_err9
  156. echo File c:\box\boxtools\diet.exe not found
  157. goto _out
  158.  
  159. :_err10
  160. echo Timo's ask.exe must be at path or current directory
  161. goto _out
  162.  
  163. :_scanerr
  164. echo Abnormal SCAN program termination
  165. goto _out
  166.  
  167. :_out
  168. set _found=
  169. echo on
  170.